Technical Field
The present invention relates to video encoding, and in particular, it relates to methods for RDO (Rate-Distortion Optimization) based on fit-curves and apparatuses using the same.
Description of the Related Art
RDO (Rate-distortion optimization) is the technology of improving video quality in video compression. It is used to optimize the amount of loss of video quality (the distortion) against the amount of data required to encode the video (the rate). Specifically, RDO determines an encoding mode to achieve a balance between the distortion and the rate to optimize video compression for a video compression system. The encoding mode may indicate a prediction mode, a MV (Motion Vector), a reference frame, or others. The purpose of the encoding-mode determination is to select the best one from multiple candidates. The video compression system may use the Lagrange R-D cost function to determine the best encoding mode as follows:min{J},J=D+λ·R  (1)D indicates the distortion between a source-frame block and a reconstructed-frame block. In the video encoding system, D may be one of the following values depending on different design requirements: SAD (Sum of Absolute Difference); SATD (Sum of Absolute Transformed Difference); and SSD (Sum of Squared Difference). R indicates bit counts required by the determined prediction mode, MV, reference frame, residual, or others. λ indicates a Lagrange constant. J is the result of the Lagrange R-D cost function. The object of RDO is to determine the candidate with the minimum value J as the best encoding mode, so as to achieve the optimized compression.
In the conventional RDO, the encoder needs to encode data several times, in each of which is together with one candidate, so as to obtain values R and D of the candidates. Then, the values R and D are input to the Equation (1) to obtain values J, and the candidate with the minimum of the values J is determined as the best encoding mode. However, each time the encoding is performed, the data should undergo T (Transform), Q (Quantization), IT (Inverse Transform), IQ (Inverse Quantization), reconstruction, entropy coding, and so on. It takes excessive computation to encode data several times. The conventional method realized in hardware circuits not only takes excessive hardware but also defers encoding so as to hinder the real-time response. Thus, methods for RDO based on fit-curves and apparatuses using the same are introduced to address the drawbacks.